<template>
    用户名:<input type="text" v-model="usercode"><br/>
    用户密码:<input type="text" v-model="password"><br/>
    <input type="button" value="登录" @click="login">
</template>



<script>
import axios from "axios"
import qs from "query-string"
    export default {
        name: "EmpLogin",
        data(){
            return{
                usercode:"",
                password:""
            }
        },
        methods:{
            login(){
                    let obj=this;
                    axios.get("/api/program/login",qs.stringify({ 
                        usercode:obj.usercode,
                        password:obj.password
                    })).then(dt=>{
                        if(dt){
                            alert("登录成功")
                            this.$router.push({path:"/programshow"})
                        }else{
                            alert("登录失败")
                        }
                    }).catch(err=>{
                        alert(err)
                    })
                }
        }
    }
</script>

<style scoped>

</style>